<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('vendor_products', function (Blueprint $table) {
            $table->id();
            $table->string('title')->comment('商品标题');
            $table->unsignedBigInteger('vendor_id')->comment('厂商id');
            $table->unsignedBigInteger('vendor_user_id')->comment('厂商用户id');
            $table->string('cover')->comment('商品封面图');
            $table->unsignedBigInteger('price')->comment('价格');
            $table->unsignedBigInteger('market_price')->default(0)->comment('市场价格');
            $table->unsignedBigInteger('wholesale_price')->default(0)->comment('批发价格');
            $table->unsignedTinyInteger('discount')->default(100)->comment('折扣 单位整数');
            $table->unsignedTinyInteger('status')->default(1)->comment('商品上架状态 0 下架 1 上架');
            $table->unsignedTinyInteger('type')->default(1)->comment('商品类型 1 实体 2 解决方案 3 服务');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('vendor_products');
    }
};
